

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/blog/img/fluid.png">
  <link rel="icon" href="/blog/img/avatar2.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Zhou Jie">
  <meta name="keywords" content="">
  
    <meta name="description" content="打包指令npm i cordova（坑：不安装导致一直打包失败） ionic cordova platform add android@版本号  添加安卓平台 ionic cordova platform remove android  移除安卓平台 ionic cordova build android    打包指令 ionic cordova build android –prod –rel">
<meta property="og:type" content="article">
<meta property="og:title" content="Ionic项目中碰到的问题合集">
<meta property="og:url" content="https://jay213.gitee.io/blog/2023/11/22/Ionic%E9%A1%B9%E7%9B%AE%E4%B8%AD%E7%A2%B0%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98%E5%90%88%E9%9B%86/index.html">
<meta property="og:site_name" content="Zhou Jie">
<meta property="og:description" content="打包指令npm i cordova（坑：不安装导致一直打包失败） ionic cordova platform add android@版本号  添加安卓平台 ionic cordova platform remove android  移除安卓平台 ionic cordova build android    打包指令 ionic cordova build android –prod –rel">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2023-11-22T08:41:40.000Z">
<meta property="article:modified_time" content="2024-04-01T03:41:22.010Z">
<meta property="article:author" content="Zhou Jie">
<meta property="article:tag" content="开发问题">
<meta name="twitter:card" content="summary_large_image">
  
  
  
  <title>Ionic项目中碰到的问题合集 - Zhou Jie</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/blog/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/blog/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/blog/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"jay213.gitee.io","root":"/blog/","version":"1.9.4","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/blog/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/blog/js/utils.js" ></script>
  <script  src="/blog/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 5.4.2"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/blog/">
      <strong>Indispensible</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/archives/">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/categories/">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/tags/">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/blog/about/">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/blog/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="Ionic项目中碰到的问题合集"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2023-11-22 16:41" pubdate>
          2023年11月22日 下午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          3.3k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          28 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">Ionic项目中碰到的问题合集</h1>
            
            
              <div class="markdown-body">
                
                <h2 id="打包指令"><a href="#打包指令" class="headerlink" title="打包指令"></a><strong>打包指令</strong></h2><p>npm i cordova（坑：不安装导致一直打包失败）</p>
<p>ionic cordova platform add android@版本号  添加安卓平台</p>
<p>ionic cordova platform remove android  移除安卓平台</p>
<p>ionic cordova build android    打包指令</p>
<p>ionic cordova build android –prod –release <strong>未签名版</strong></p>
<h2 id="问题"><a href="#问题" class="headerlink" title="问题"></a><strong>问题</strong></h2><h3 id="cordova插件使用"><a href="#cordova插件使用" class="headerlink" title="cordova插件使用"></a>cordova插件使用</h3><p>​    插件使用前先注入app.moudle.ts中 在provide中声明</p>
<h4 id="退出插件"><a href="#退出插件" class="headerlink" title="退出插件"></a>退出插件</h4><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs awk">cordova plugin add cordova-plugin-app-<span class="hljs-keyword">exit</span><br>npm i cordova-plugin-app-<span class="hljs-keyword">exit</span><br>navigator[<span class="hljs-string">&#x27;app&#x27;</span>].exitApp();<br></code></pre></td></tr></table></figure>

<h4 id="扫码插件"><a href="#扫码插件" class="headerlink" title="扫码插件"></a>扫码插件</h4><figure class="highlight typescript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><code class="hljs typescript">ionic cordova plugin add cordova-plugin-cszbar<br>npm install <span class="hljs-meta">@ionic</span>-native/zbar<br><br><span class="hljs-keyword">import</span> &#123; <span class="hljs-title class_">ZBar</span>, <span class="hljs-title class_">ZBarOptions</span> &#125; <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@ionic-native/zbar/ngx&#x27;</span>;<br><br><span class="hljs-title function_">constructor</span>(<span class="hljs-params"><span class="hljs-keyword">private</span> zbar: ZBar</span>) &#123; &#125;<br><br>...<br><br><span class="hljs-keyword">let</span> <span class="hljs-attr">options</span>: <span class="hljs-title class_">ZBarOptions</span> = &#123;<br>      <span class="hljs-attr">flash</span>: <span class="hljs-string">&#x27;off&#x27;</span>,<br>      <span class="hljs-attr">drawSight</span>: <span class="hljs-literal">false</span><br>    &#125;<br><br><span class="hljs-variable language_">this</span>.<span class="hljs-property">zbar</span>.<span class="hljs-title function_">scan</span>(options)<br>   .<span class="hljs-title function_">then</span>(<span class="hljs-function"><span class="hljs-params">result</span> =&gt;</span> &#123;<span class="hljs-comment">//扫描结果</span><br>      <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(result); <span class="hljs-comment">// Scanned code</span><br>   &#125;)<br>   .<span class="hljs-title function_">catch</span>(<span class="hljs-function"><span class="hljs-params">error</span> =&gt;</span> &#123;<br>      <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(error); <span class="hljs-comment">// Error message</span><br>   &#125;);<br></code></pre></td></tr></table></figure>

<h4 id="键盘组件"><a href="#键盘组件" class="headerlink" title="键盘组件"></a>键盘组件</h4><figure class="highlight oxygene"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><code class="hljs oxygene">ionic cordova plugin <span class="hljs-keyword">add</span> cordova-plugin-ionic-keyboard<br>npm install @ionic-native/keyboard<br><br>import <span class="hljs-comment">&#123; Keyboard &#125;</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@ionic-native/keyboard/ngx&#x27;</span><span class="hljs-punctuation">;</span><br><br><span class="hljs-keyword">constructor</span><span class="hljs-params">(<span class="hljs-keyword">private</span> keyboard: Keyboard)</span> <span class="hljs-comment">&#123; &#125;</span><br><br>...<br><br><span class="hljs-title function_">this</span>.<span class="hljs-title function_">keyboard</span>.<span class="hljs-title function_">show</span><span class="hljs-params">()</span>;<br><br>this.keyboard.hide()<span class="hljs-punctuation">;</span><br></code></pre></td></tr></table></figure>

<h4 id="gradle的坑"><a href="#gradle的坑" class="headerlink" title="gradle的坑"></a>gradle的坑</h4><figure class="highlight dns"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs dns">依賴下載failed<br><br>將C:\Users\K<span class="hljs-number">19122897</span>.WKSCN\.gradle下的gradle.properties文檔的後面四行注釋<br></code></pre></td></tr></table></figure>

<h4 id="导航栏不显示"><a href="#导航栏不显示" class="headerlink" title="导航栏不显示"></a>导航栏不显示</h4><p>aap.component.ts中添加如下代碼</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><code class="hljs ionic">initializeApp() &#123;<br> this.platform.ready().then(() =&gt; &#123;<br>  this.statusBar.styleDefault();<br>  //顯示狀態欄<br>  if (this.platform.is(&#x27;android&#x27;)) &#123;<br>  		this.statusBar.overlaysWebView(false);<br>	this.statusBar.backgroundColorByHexString(&#x27;#616161&#x27;);<br> &#125;<br>  this.splashScreen.hide(<br> &#125;);<br>&#125;<br></code></pre></td></tr></table></figure>

<h3 id="ionic事件监听"><a href="#ionic事件监听" class="headerlink" title="ionic事件监听"></a>ionic事件监听</h3><h4 id="返回键监听"><a href="#返回键监听" class="headerlink" title="返回键监听"></a>返回键监听</h4><p><a target="_blank" rel="noopener" href="https://ionicframework.com/docs/developing/hardware-back-button">https://ionicframework.com/docs/developing/hardware-back-button</a></p>
<figure class="highlight delphi"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><code class="hljs delphi">import <span class="hljs-comment">&#123; Platform &#125;</span> from <span class="hljs-string">&#x27;@ionic/angular&#x27;</span>;<br><br>...<br><br><span class="hljs-function"><span class="hljs-keyword">constructor</span><span class="hljs-params">(<span class="hljs-keyword">private</span> <span class="hljs-keyword">platform</span>: <span class="hljs-keyword">Platform</span>)</span> <span class="hljs-comment">&#123;</span></span><br><span class="hljs-comment"><span class="hljs-function">  this.platform.backButton.subscribeWithPriority(5, () =&gt; &#123;</span></span><br><span class="hljs-comment"><span class="hljs-function">    console.log(&#x27;Another handler was called!&#x27;);</span></span><br><span class="hljs-comment"><span class="hljs-function">  &#125;</span>);</span><br><br>  this.<span class="hljs-keyword">platform</span>.backButton.subscribeWithPriority(<span class="hljs-number">10</span>, (processNextHandler) =&gt; <span class="hljs-comment">&#123;</span><br><span class="hljs-comment">    console.log(&#x27;Handler was called!&#x27;);</span><br><span class="hljs-comment"></span><br><span class="hljs-comment">    processNextHandler();</span><br><span class="hljs-comment"></span><br><span class="hljs-comment">  &#125;</span>);<br>&#125;<br></code></pre></td></tr></table></figure>

<h4 id="Ionic5-Angular中使用EventEmitter事件驱动实现不同页面通讯"><a href="#Ionic5-Angular中使用EventEmitter事件驱动实现不同页面通讯" class="headerlink" title="Ionic5 Angular中使用EventEmitter事件驱动实现不同页面通讯"></a>Ionic5 Angular中使用EventEmitter事件驱动实现不同页面通讯</h4><p><a target="_blank" rel="noopener" href="http://www.ionic.wang/article-index-id-204.html">http://www.ionic.wang/article-index-id-204.html</a></p>
<figure class="highlight ada"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs ada">npm install <span class="hljs-comment">--save eventemitter3</span><br></code></pre></td></tr></table></figure>

<figure class="highlight typescript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><code class="hljs typescript">在服務中定義<br><span class="hljs-keyword">import</span> &#123; <span class="hljs-title class_">Injectable</span>&#125; <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@angular/core&#x27;</span>;<br><span class="hljs-keyword">import</span> &#123;<span class="hljs-title class_">EventEmitter</span>&#125; <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;eventemitter3&#x27;</span>;<br><span class="hljs-meta">@Injectable</span>(&#123;<br>  <span class="hljs-attr">providedIn</span>: <span class="hljs-string">&#x27;root&#x27;</span><br>&#125;)<br><span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> <span class="hljs-title class_">EventService</span> &#123;<br>  <span class="hljs-keyword">public</span> <span class="hljs-attr">eventEmit</span>: <span class="hljs-built_in">any</span>;<br>  <span class="hljs-title function_">constructor</span>(<span class="hljs-params"></span>) &#123;<br>    <span class="hljs-comment">// 定义发射事件</span><br>    <span class="hljs-variable language_">this</span>.<span class="hljs-property">eventEmit</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">EventEmitter</span>();<br>  &#125;<br>&#125;<br><br><span class="hljs-comment">//監聽</span><br><span class="hljs-keyword">import</span> &#123; <span class="hljs-title class_">EventService</span> &#125; <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;../services/event.service&#x27;</span>;<br><br><span class="hljs-variable language_">this</span>.<span class="hljs-property">eventService</span>.<span class="hljs-property">eventEmit</span>.<span class="hljs-title function_">on</span>(<span class="hljs-string">&#x27;login&#x27;</span>,<span class="hljs-function">(<span class="hljs-params">result</span>)=&gt;</span>&#123;<br>      <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;执行&#x27;</span>);<br>&#125;)<br><br><span class="hljs-comment">//發佈廣播</span><br><span class="hljs-keyword">import</span> &#123; <span class="hljs-title class_">EventService</span> &#125; <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;../services/event.service&#x27;</span>;<br><span class="hljs-title function_">ionViewDidLeave</span>(<span class="hljs-params"></span>)&#123;<br><span class="hljs-variable language_">this</span>.<span class="hljs-property">eventService</span>.<span class="hljs-property">eventEmit</span>.<span class="hljs-title function_">emit</span>(<span class="hljs-string">&#x27;login&#x27;</span>,<span class="hljs-string">&#x27;登录页面退出了&#x27;</span>);<br>&#125;<br></code></pre></td></tr></table></figure>

<h3 id="解決android10系統上無法訪問http請求"><a href="#解決android10系統上無法訪問http請求" class="headerlink" title="解決android10系統上無法訪問http請求"></a>解決android10系統上無法訪問http請求</h3><p><strong>android:usesCleartextTraffic=”true”</strong></p>
<p>將E:\mycase\mo\UI\11-18\1\platforms\android\app\src\main目錄下AndroidManifest.xml修改如下</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">application</span> <span class="hljs-attr">android:label</span>=<span class="hljs-string">&quot;Cha.Android&quot;</span> <span class="hljs-attr">android:usesCleartextTraffic</span>=<span class="hljs-string">&quot;true&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">application</span>&gt;</span><br><br><span class="hljs-meta">&lt;?xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;utf-8&quot;</span>?&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">manifest</span> <span class="hljs-attr">...</span>&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">uses-permission</span> <span class="hljs-attr">android:name</span>=<span class="hljs-string">&quot;android.permission.INTERNET&quot;</span> /&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-name">application</span></span><br><span class="hljs-tag">        <span class="hljs-attr">...</span></span><br><span class="hljs-tag">        <span class="hljs-attr">android:usesCleartextTraffic</span>=<span class="hljs-string">&quot;true&quot;</span> //<span class="hljs-attr">看这里</span></span><br><span class="hljs-tag">        <span class="hljs-attr">...</span>&gt;</span><br>        ...<br>    <span class="hljs-tag">&lt;/<span class="hljs-name">application</span>&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">manifest</span>&gt;</span><br><br>巨坑 o.0<br></code></pre></td></tr></table></figure>


                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/blog/categories/Ionic/" class="category-chain-item">Ionic</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/blog/tags/%E5%BC%80%E5%8F%91%E9%97%AE%E9%A2%98/">#开发问题</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>Ionic项目中碰到的问题合集</div>
      <div>https://jay213.gitee.io/blog/2023/11/22/Ionic项目中碰到的问题合集/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>Zhou Jie</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2023年11月22日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/blog/2023/12/09/Vue%E4%B8%AD%E5%8F%8C%E5%90%91%E7%BB%91%E5%AE%9A%E5%92%8C%E5%93%8D%E5%BA%94%E5%BC%8F%E7%9A%84%E5%85%B3%E7%B3%BB/" title="Vue中双向绑定和响应式的关系">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Vue中双向绑定和响应式的关系</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/blog/2023/11/14/%E5%85%B3%E4%BA%8E%E5%81%9A%E4%BA%BA%E7%9A%84%E6%80%9D%E8%80%83/" title="关于做人的思考">
                        <span class="hidden-mobile">关于做人的思考</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
  
  
    <article id="comments" lazyload>
      
  <div class="disqus" style="width:100%">
    <div id="disqus_thread"></div>
    
      <script type="text/javascript">
        var disqus_config = function() {
          this.page.url = 'https://jay213.gitee.io/blog/2023/11/22/Ionic%E9%A1%B9%E7%9B%AE%E4%B8%AD%E7%A2%B0%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98%E5%90%88%E9%9B%86/';
          this.page.identifier = '/blog/2023/11/22/Ionic%E9%A1%B9%E7%9B%AE%E4%B8%AD%E7%A2%B0%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98%E5%90%88%E9%9B%86/';
        };
        Fluid.utils.loadComments('#disqus_thread', function() {
          var d = document, s = d.createElement('script');
          s.src = '//' + 'fluid' + '.disqus.com/embed.js';
          s.setAttribute('data-timestamp', new Date());
          (d.head || d.body).appendChild(s);
        });
      </script>
    
    <noscript>Please enable JavaScript to view the comments</noscript>
  </div>


    </article>
  


          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/blog/js/events.js" ></script>
<script  src="/blog/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/blog/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/blog/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/blog/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
